import request from '@/utils/request'

const api_name = '/admin/system/sysRole'

export const GetSysRoleListByPage = (pageNum,pageSize,queryDto) => {
    //debugger
    return request({
        url: `${api_name}/findByPage/${pageNum}/${pageSize}`,
        method: 'get',
        params: queryDto
    })
}

export const SaveSysRole = (data) => {
    return request({
        url: `${api_name}/saveSysRole`,
        method: 'post',
        data
    })
}

export const UpdateSysRole = (data) => {
    return request({
        url: `${api_name}/updateSysRole`,
        method: 'put',
        data
    })
}

export const DeleteSysRoleById = (roleId) => {
    return request({
        url: `${api_name}/deleteById/${roleId}`,
        method: 'delete'
    })
}

// 查询所有的角色数据
// export const GetAllRoleList = () => {
//     return request({
//         url: `${api_name}/findAllRoles`,
//         method: 'get'
//     })
// }

export const GetAllRoleList = (userId) => {
    return request({
        url: `${api_name}/findAllRoles/${userId}`,
        method: 'get'
    })
}

export const DoAssignMenuIdToSysRole = (assignMenuDto) => {
    return request({
        url: `/admin/system/sysRoleMenu/doAssign`,
        method: 'post',
        data: assignMenuDto
    }) 
}